package controller

import (
	"mini-app/config/mysql"
	"mini-app/internal/dao"
	"strconv"

	"192.168.1.75/go-pkg/response"
	"github.com/gin-gonic/gin"
)

type Announcement struct{}

func (Announcement) List(c *gin.Context) {
	page, _ := strconv.Atoi(c.Query("page"))
	limit, _ := strconv.Atoi(c.Query("limit"))
	list, total := dao.Announcement{}.List(c.Request.Context(), mysql.NewDB(), "", 2, page, limit)
	response.JSON(c, gin.H{
		"list":  list,
		"total": total,
	}, nil)
}
